home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 36 / vfos_dv.zip / VIO_DRCT.INC < prev    next >
Text File  |  1988-08-13  |  14KB  |  513 lines

  1. ;
  2. ; VFOS_IBM VFOSSIL driver by Bob Hartman  (SysOp of 1:132/101).
  3. ; Copyright 1988 by Spark Software.  ALL RIGHTS RESERVED.
  4. ;
  5.  
  6. VioGetMode proc far
  7.  
  8.         Enter_Vio
  9.  
  10.         Check_Handle 00
  11.  
  12.         les     di,[bp+8]               ; get pointer to buffer
  13.         mov     cx,es:[di]              ; get length
  14.         push    cs                      ; set up ds
  15.         pop     ds
  16.         mov     si,offset mode_info     ; get pointer to mode buffer
  17.         cmp     cx,es:[di]              ; how does it stack up
  18.         jbe     f00_100                 ; it looks ok
  19.         mov     cx,es:[di]              ; get the other value
  20.  
  21. f00_100:
  22.         cmp     cx,3                    ; is it less than 3
  23.         jae     f00_101                 ; it is still good
  24.         mov     ax,382                  ; bad buffer size
  25.         jmp     f00_out                 ; get out
  26.  
  27. f00_101:
  28.         cld
  29.         repnz   movsb                   ; move the data
  30.  
  31.         mov     ax,0                    ; set up return code
  32.  
  33.         Exit_Vio 00,6                   ; get out
  34.  
  35. VioGetMode endp
  36.  
  37. VioSetMode proc far
  38.  
  39.         mov     ax,355
  40.         ret     6
  41.  
  42. VioSetMode endp
  43.  
  44. VioGetConfig proc far
  45.  
  46.         Enter_Vio
  47.  
  48.         Check_Handle 02
  49.  
  50.         les     di,[bp+8]               ; get pointer to buffer
  51.         mov     cx,es:[di]              ; get length
  52.         push    cs                      ; set up ds
  53.         pop     ds
  54.         mov     si,offset mode_info     ; get pointer to mode buffer
  55.         cmp     cx,es:[di]              ; how does it stack up
  56.         jbe     f02_100                 ; it looks ok
  57.         mov     cx,es:[di]              ; get the other value
  58.  
  59. f02_100:
  60.         cld
  61.         repnz   movsb                   ; move the data
  62.  
  63.         mov     ax,0                    ; set up return code
  64.  
  65.         Exit_Vio 02,6                   ; get out
  66.  
  67. VioGetConfig endp
  68.  
  69. VioWrtTTY proc far
  70.  
  71.         Enter_Vio
  72.  
  73.         Check_Handle 03
  74.  
  75.         push    cs
  76.         pop     ds
  77.         mov     ax,ansi_state           ; get current ANSI mode
  78.         mov     cx,[bp+8]               ; get string length
  79.         lds     dx,[bp+10]              ; get pointer to string
  80.        
  81.         or      ax,ax                   ; are we in ANSI mode?
  82.         jz      f03_100                 ; no ANSI, do it the other way
  83.  
  84.         mov     ah,40h                  ; set up for a write call
  85.         mov     bx,1                    ; use stdout
  86.         int     21h                     ; go do it
  87.  
  88.         jmp     f03_ok                  ; get out
  89.  
  90. f03_100:
  91.         mov     si,dx                   ; get the pointer to ds:si
  92.  
  93. f03_101:
  94.         lodsb                           ; get a byte
  95.         mov     ah,0eh                  ; write TTY mode
  96.         mov     bh,0                    ; page number
  97.         int     10h                     ; go do it through the BIOS
  98.         loop    f03_101                 ; do another one
  99.  
  100. f03_ok:
  101.         mov     ax,0                    ; say it was all ok
  102.  
  103.         Exit_Vio 03,8                   ; get out
  104.  
  105. VioWrtTTY endp
  106.  
  107. VioGetANSI proc far
  108.  
  109.         Enter_Vio
  110.  
  111.         Check_Handle 04
  112.  
  113.         push    cs
  114.         pop     ds
  115.         mov     ax,ansi_state           ; get current ansi state
  116.         les     di,[bp+8]               ; get pointer for where to put it
  117.         stosw                           ; mov it there
  118.  
  119.         mov     ax,0                    ; all is ok
  120.  
  121.         Exit_Vio 04,6                   ; get out
  122.  
  123. VioGetANSI endp
  124.  
  125. VioSetANSI proc far
  126.  
  127.         Enter_Vio
  128.  
  129.         Check_Handle 05
  130.  
  131.         lds     si,[bp+8]               ; get the pointer to the state
  132.         lodsw                           ; get the state
  133.         push    cs
  134.         pop     ds
  135.         mov     ansi_state,ax           ; save it away
  136.  
  137.         mov     ax,0                    ; all ok
  138.  
  139.         Exit_Vio 05,6                   ; get out
  140.  
  141. VioSetANSI endp
  142.  
  143. VioGetCurPos proc far
  144.  
  145.         Enter_Vio
  146.  
  147.         Check_Handle 06
  148.  
  149.         mov     ah,3                    ; get cursor position BIOS call
  150.         mov     bh,0
  151.         int     10h                     ; actually get it
  152.  
  153.         les     di,[bp+8]               ; get the pointer to the row
  154.         mov     dh,al                   ; save row in al
  155.         xor     ah,ah                   ; clear out ah
  156.         stosw                           ; store the row
  157.  
  158.         les     di,[bp+12]              ; get the pointer to the column
  159.         mov     dl,al                   ; get the column to al
  160.         stosw                           ; store the column
  161.  
  162.         mov     ax,0                    ; all ok
  163.  
  164.         Exit_Vio 06,10                  ; get out
  165.  
  166. VioGetCurPos endp
  167.  
  168. VioSetCurPos proc far
  169.  
  170.         Enter_Vio
  171.  
  172.         Check_Handle 07
  173.  
  174.         mov     ah,2                    ; BIOS call to set the cursor pos
  175.         mov     bh,0
  176.         mov     dh,byte ptr [bp+10]     ; get the row
  177.         cmp     dh,0                    ; check to see it is ok
  178.         jae     f07_100
  179.         mov     ax,358                  ; no good
  180.         jmp     f07_out
  181.  
  182. f07_100:
  183.         cmp     dh,24                   ; check it again
  184.         jbe     f07_101
  185.         mov     ax,358                  ; no good
  186.         jmp     f07_out
  187.  
  188. f07_101:
  189.         mov     dl,byte ptr [bp+8]      ; get the column
  190.         cmp     dl,0                    ; check if it is ok
  191.         jae     f07_102
  192.         mov     ax,359                  ; no good
  193.         jmp     f07_out
  194.  
  195. f07_102:
  196.         cmp     dl,79                   ; check it again
  197.         jbe     f07_103
  198.         mov     ax,359                  ; no good
  199.         jmp     f07_out
  200.  
  201. f07_103:
  202.         int     10h                     ; do the BIOS call
  203.  
  204.         mov     ax,0                    ; all ok
  205.  
  206.         Exit_Vio 07,6                   ; get out
  207.  
  208. VioSetCurPos endp
  209.  
  210. VioGetCurType proc far
  211.  
  212.         Enter_Vio
  213.  
  214.         Check_Handle 08
  215.  
  216.         les     di,[bp+8]               ; get pointer to buffer
  217.         push    cs                      ; set up ds
  218.         pop     ds
  219.         mov     si,offset curs_info     ; get pointer to cursor info
  220.         mov     cx,8                    ; length of cursor info
  221.  
  222.         cld
  223.         repnz   movsb                   ; move the data
  224.  
  225.         mov     ax,0                    ; set up return code
  226.  
  227.         Exit_Vio 08,6                   ; get out
  228.  
  229. VioGetCurType endp
  230.  
  231. VioSetCurType proc far
  232.  
  233.         Enter_Vio
  234.  
  235.         Check_Handle 09
  236.  
  237.         mov     ax,cs
  238.         mov     es,ax
  239.         mov     ds,ax
  240.         lds     si,[bp+8]               ; get pointer to buffer
  241.  
  242.         mov     ch,byte ptr ds:[si]     ; get column
  243.         mov     cl,byte ptr ds:[si+2]   ; get row
  244.         mov     ax,ds:[si+6]            ; get attribute
  245.         cmp     ax,-1                   ; is it off?
  246.         jne     f09_100                 ; no, so continue
  247.         mov     ch,30h                  ; turn off cursor
  248.         mov     ch,30h                  ; turn off cursor
  249.  
  250. f09_100:
  251.         mov     ah,1
  252.         mov     bh,0
  253.         int     10h                     ; use BIOS to set the position
  254.  
  255.         mov     di,offset curs_info     ; get pointer to cursor info
  256.         lds     si,[bp+8]               ; get pointer to buffer
  257.         mov     cx,8                    ; length of cursor info
  258.  
  259.         cld
  260.         repnz   movsb                   ; move the data
  261.  
  262.         mov     ax,0                    ; set up return code
  263.  
  264.         Exit_Vio 09,6                   ; get out
  265.  
  266. VioSetCurType endp
  267.  
  268. VioScrollUp proc far
  269.  
  270.         Enter_Vio
  271.  
  272.         Check_Handle 10
  273.  
  274. ; set up address of upper left corner, checking for out of range
  275. ; check bottom right corner for out of range
  276. ; determine number of words to copy per line
  277. ; determine number of rows to do
  278. ; move each line
  279. ; fill in blanked lines
  280.  
  281.         mov     ax,116
  282.  
  283.         Exit_Vio 10,16                  ; get out
  284.  
  285. VioScrollUp endp
  286.  
  287. VioScrollDn proc far
  288.  
  289.         Enter_Vio
  290.  
  291.         Check_Handle 11
  292.  
  293. ; set up address of upper left corner, checking for out of range
  294. ; check bottom right corner for out of range
  295. ; determine number of words to copy per line
  296. ; determine number of rows to do
  297. ; move each line
  298. ; fill in blanked lines
  299.  
  300.         mov     ax,116
  301.  
  302.         Exit_Vio 11,16                  ; get out
  303.  
  304. VioScrollDn endp
  305.  
  306. VioReadCellStr proc far
  307.  
  308.         Enter_Vio
  309.  
  310.         Check_Handle 12
  311.  
  312.         Do_Row_Col 12,10,8
  313.  
  314.         mov     si,di                   ; get the address as source index
  315.         mov     ax,adapter_base         ; offset for color card
  316.         mov     ds,ax                   ; ds:si is now set up
  317.  
  318.         les     di,[bp+14]              ; get the pointer to count
  319.         mov     cx,es:[di];             ; put count in cx
  320.         les     di,[bp+18]              ; get the pointer in es:di
  321.  
  322.         cld
  323.         repnz   movsb                   ; move the bytes
  324.  
  325.         mov     ax,0                    ; successful return
  326.  
  327.         Exit_Vio 12,14                  ; get out
  328.  
  329. VioReadCellStr endp
  330.  
  331. VioReadCharStr proc far
  332.  
  333.         Enter_Vio
  334.  
  335.         Check_Handle 13
  336.  
  337.         Do_Row_Col 13,10,8
  338.  
  339.         mov     si,di                   ; get the address as source index
  340.         mov     ax,adapter_base         ; offset for color card
  341.         mov     ds,ax                   ; ds:si is now set up
  342.  
  343.         les     di,[bp+14]              ; get length pointer
  344.         mov     cx,es:[di]              ; get length
  345.         les     di,[bp+18]              ; get the pointer in es:di
  346.  
  347. f13_100:
  348.         movsb                           ; move a byte
  349.         inc     di                      ; get past attribute
  350.         loop    f13_100                 ; do the next one
  351.  
  352.         mov     ax,0                    ; successful return
  353.  
  354.         Exit_Vio 13,14                  ; get out
  355.  
  356. VioReadCharStr endp
  357.  
  358. VioWrtCellStr proc far
  359.  
  360.         Enter_Vio
  361.  
  362.         Check_Handle 14
  363.  
  364.         Do_Row_Col 14,10,8
  365.  
  366.         mov     ax,adapter_base         ; offset for color card
  367.         mov     es,ax                   ; es:di is now set up
  368.  
  369.         mov     cx,[bp+12]              ; get length
  370.         lds     si,[bp+14]              ; get the pointer in ds:si
  371.  
  372.         cld
  373.         repnz   movsb                   ; move the bytes
  374.  
  375.         mov     ax,0                    ; successful return
  376.  
  377.         Exit_Vio 14,12                  ; get out
  378.  
  379. VioWrtCellStr endp
  380.  
  381. VioWrtCharStr proc far
  382.  
  383.         Enter_Vio
  384.  
  385.         Check_Handle 15
  386.  
  387.         Do_Row_Col 15,10,8
  388.  
  389.         mov     ax,adapter_base         ; offset for color card
  390.         mov     es,ax                   ; es:di is now set up
  391.  
  392.         mov     cx,[bp+12]              ; get length
  393.         lds     si,[bp+14]              ; get the pointer in ds:si
  394.  
  395. f15_100:
  396.         movsb                           ; move a byte
  397.         inc     di                      ; get past attribute
  398.         loop    f15_100                 ; do the next one
  399.  
  400.         mov     ax,0                    ; successful return
  401.  
  402.         Exit_Vio 15,12                  ; get out
  403.  
  404. VioWrtCharStr endp
  405.  
  406. VioWrtCharStrAtt proc far
  407.  
  408.         Enter_Vio
  409.  
  410.         Check_Handle 16
  411.  
  412.         Do_Row_Col 16,14,12
  413.  
  414.         mov     ax,adapter_base         ; offset for color card
  415.         mov     es,ax                   ; es:di is now set up
  416.  
  417.         mov     cx,[bp+16]              ; get length
  418.         lds     si,[bp+8]               ; get the pointer in ds:si
  419.         lodsb                           ; get the attribute
  420.         mov     ah,al                   ; save the attribute
  421.         lds     si,[bp+18]              ; get the pointer to chars
  422.  
  423. f16_100:
  424.         lodsb                           ; get the character
  425.         xchg    ah,al                   ; put in proper order
  426.         stosw                           ; save the cell
  427.         xchg    ah,al                   ; save attribute again
  428.         loop    f16_100                 ; loop for next one
  429.  
  430.         mov     ax,0                    ; successful return
  431.  
  432.         Exit_Vio 16,16                  ; get out
  433.  
  434. VioWrtCharStrAtt endp
  435.  
  436. VioWrtNAttr proc far
  437.  
  438.         Enter_Vio
  439.  
  440.         Check_Handle 17
  441.  
  442.         Do_Row_Col 17,10,8
  443.  
  444.         mov     ax,adapter_base         ; offset for color card
  445.         mov     es,ax                   ; es:di is now set up
  446.  
  447.         mov     cx,[bp+12]              ; get length
  448.         lds     si,[bp+14]              ; get the pointer in ds:si
  449.         lodsb                           ; get the character attribute
  450.  
  451. f17_100:
  452.         inc     di                      ; get past character byte
  453.         stosb                           ; save the attribute
  454.         loop    f17_100                 ; loop for next one
  455.  
  456.         mov     ax,0                    ; successful return
  457.  
  458.         Exit_Vio 17,12                  ; get out
  459.  
  460. VioWrtNAttr endp
  461.  
  462. VioWrtNCell proc far
  463.  
  464.         Enter_Vio
  465.  
  466.         Check_Handle 18
  467.  
  468.         Do_Row_Col 18,10,8
  469.  
  470.         mov     ax,adapter_base         ; offset for color card
  471.         mov     es,ax                   ; es:di is now set up
  472.  
  473.         mov     cx,[bp+12]              ; get length
  474.         lds     si,[bp+14]              ; get the pointer in ds:si
  475.         lodsw                           ; get the character cell in AX
  476.  
  477.         cld
  478.         repnz   stosw                   ; save the cell
  479.  
  480.         mov     ax,0                    ; successful return
  481.  
  482.         Exit_Vio 18,12                  ; get out
  483.  
  484. VioWrtNCell endp
  485.  
  486. VioWrtNChar proc far
  487.  
  488.         Enter_Vio
  489.  
  490.         Check_Handle 19
  491.  
  492.         Do_Row_Col 19,10,8
  493.  
  494.         mov     ax,adapter_base         ; offset for color card
  495.         mov     es,ax                   ; es:di is now set up
  496.  
  497.         mov     cx,[bp+12]              ; get length
  498.         lds     si,[bp+14]              ; get the pointer in ds:si
  499.         lodsb                           ; get the character
  500.  
  501. f19_100:
  502.         stosb                           ; save the character
  503.         inc     di                      ; get past attribute byte
  504.         loop    f19_100                 ; loop for next one
  505.  
  506.         mov     ax,0                    ; successful return
  507.  
  508.         Exit_Vio 19,12                  ; get out
  509.  
  510. VioWrtNChar endp
  511.  
  512.  
  513.